home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2002 #11 / Amiga Plus CD - 2002 - No. 11.iso / amigaoscd / amigapluscd / AP-Website / links / admin / edit_site.php < prev    next >
PHP Script  |  2001-07-22  |  4KB  |  145 lines

  1. <?
  2. // *******************************************************************
  3. //  admin/edit_site.php
  4. // *******************************************************************
  5.  
  6. include("../include/config.php");
  7. include("../include/functions.php");
  8.  
  9. include("../include/common.php");
  10. $language = $gl["Language"];
  11.  
  12. include("../include/lang/$language.php");
  13.  
  14. include("../include/session.php");
  15. session_start();
  16. ?>
  17. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  18. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
  19. <html>
  20. <head>
  21. <title></title>
  22. <link rel = "stylesheet" type = "text/css" href = "style.css" />
  23. </head>
  24. <?=$adm_body?>
  25. <?
  26. if(isset($update) && isset($ID)){
  27.  
  28.     $result = sql_query("
  29.         update
  30.             $tb_links
  31.         set
  32.             SiteName='$SiteName',
  33.             SiteURL='$SiteURL',
  34.             Description='$Description',
  35.             Category='$Category',
  36.             Country='$Country',
  37.             Email='$Email'
  38.         where
  39.             ID='$ID'
  40.     ");
  41.  
  42.     
  43. }
  44.  
  45. if(isset($ID)){
  46.  
  47.     $get_site = sql_query("
  48.         select
  49.             *
  50.         from
  51.             $tb_links
  52.         where
  53.             ID='$ID'
  54.     ");
  55.  
  56.     $rows = sql_fetch_array($get_site);
  57.     
  58.     ?><table cellspacing="0" cellpadding="5" border="1" align="center" width="100%">
  59.     <tr><form method="post" action="edit_site.php?<?=session_name()?>=<?=session_id()?>">
  60.     <input type="hidden" name="ID" value="<?=$ID?>"><?
  61.     
  62.         if($p==1){
  63.             ?><input type="hidden" name="p" value="1"><?
  64.         }
  65.  
  66.         ?><td colspan="2" class="theader">
  67.             <table cellpadding="0" cellspacing="0" border="0" width="100%">
  68.             <tr>
  69.                 <td class="theader">Edit Site<?
  70.                     if(isset($update) && isset($ID)){
  71.                         ?> - Site Has been updated.<?
  72.                     } 
  73.                     ?></td><?
  74.                     if($p==1){
  75.                         ?><td align="right" class="text">[ <a 
  76.         href="<?=$rows[SiteURL]?>" target="_blank">View Site</a> ] [ <a 
  77.         href="delete_site.php?<?=session_name()?>=<?=session_id()?>&dbtable=links&ID=<?
  78.         
  79.         echo $rows[ID];
  80.         
  81.         if(isset($p)){
  82.             echo "&p=" . $p;
  83.         }
  84.         ?>">Delete Site</a> ] [ <a href="javascript:window.close();">Close Window</a> ]</td><?
  85.                     }?>
  86.             </tr>
  87.             </table>
  88.             </td>
  89.     </tr>
  90.     <tr>
  91.         <td class="text">Site Name: </td>
  92.         <td><input class="small" type="text" name="SiteName" 
  93.         value="<?=stripslashes($rows[SiteName])?>" size="35"></td>
  94.     </tr>
  95.     <tr>
  96.         <td class="text">Site URL: </td>
  97.         <td class="text"><input class="small" type="text" name="SiteURL" 
  98.         value="<?=$rows[SiteURL]?>" size="35"></td>
  99.     </tr>
  100.     <tr>
  101.         <td class="text">Description: </td>
  102.         <td><textarea class="small" name="Description" rows="7" 
  103.         cols="40" wrap="virtual"><?=stripslashes($rows[Description])?></textarea></td>
  104.     </tr>
  105.     <tr>
  106.         <td class="text">Category: </td>
  107.         <td><select class="small" name="Category"><?
  108.             drop_cats($rows[Category], 0, "", $cats);
  109.             echo $cats;
  110.         ?></select></td>
  111.     </tr>
  112.     <tr>
  113.         <td class="text">Country: </td>
  114.         <td><select class="small" name="Country"><?
  115.         if($d = dir("../images/flags")){
  116.             echo getFlagList("../images/flags", $rows[Country]);
  117.         }
  118.         ?></select></td>
  119.     </tr>
  120.     <tr>
  121.         <td class="text">Email</td>
  122.         <td><input class="small" type="text" name="Email" value="<?=$rows[Email]?>" 
  123.         size="35"></td>
  124.     </tr>
  125.     <tr>
  126.         <td colspan="2" align="center"><input class="button" type="submit" name="update" 
  127.         value=" Update Site "></td>
  128.     </form></tr></table><?
  129.  
  130. }
  131.  
  132. if(!isset($ID) && !isset($update)){
  133.     ?><table cellspacing="0" cellpadding="5" border="1" align="center" width="100%">
  134.     <tr>
  135.     <form method="post" action="edit_site.php?<?=session_name()?>=<?=session_id()?>">
  136.         <td class="theader">Please enter a site ID: 
  137.         <input class="small" type="text" name="ID" size="5">
  138.         <input class="button" type="submit" name="submit" value=" Edit Site "></td>
  139.     </form></tr>
  140.     </table><?
  141. }
  142. ?>
  143. </body>
  144. </html>
  145.